﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using GeckoPhotos.Models;
using GeckoPhotos.Service;
using GeckoPhotos.Repository;

namespace GeckoPhotos.Controllers
{
    [HandleError]
    public class HomeController : Controller
    {
        private readonly HomeServiceLayer _service;

        public HomeController()
            : this(null)
        {
        }

        public HomeController(HomeServiceLayer service)
        {
            _service = service ?? new HomeServiceLayer(new EFHomeRepository());
        }

        public ActionResult Index()
        {
            IEnumerable<Message> messages = _service.GetHomeMessages();
            return View(messages);
        }

        public ActionResult About()
        {
            return View();
        }
    }
}
